package com.bw.controller;

import com.bw.bean.ProvinceInfoStats;
import com.bw.service.ProvinceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/pay")
public class ProvinceInfoController {

    @Autowired
    ProvinceInfoService provinceInfoService;

    @RequestMapping("/ProvinceInfo")
    public Map getProvinceInfo(){
        List<ProvinceInfoStats> province = provinceInfoService.getTotalProvince();
        Map resMap = new HashMap();
        resMap.put("status", 0);
        List dataList = new ArrayList();
        for (ProvinceInfoStats stats : province) {
            Map dataMap = new HashMap();
            dataMap.put("cnt1",stats.getCnt1());
            dataList.add(dataMap);
        }

        resMap.put("data",dataList);
        return resMap;
    }
}













